﻿namespace = dvg_nov_non_russians

# Non russians start event
dvg_nov_non_russians.1 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_capitalists_meeting.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/capitalists_meeting"

	icon = "gfx/interface/icons/event_icons/event_default.dds"

	title = dvg_nov_non_russians.1.t
	desc = dvg_nov_non_russians.1.d
	flavor = dvg_nov_non_russians.1.f

	duration = 3

	trigger = {
		exists = c:VYA
		this = c:VYA
		year = 1840
		NOT = { has_variable = VYA_nonrussians }
		NOT = { has_variable = VYA_nonrussians_end }
	}

	immediate = {
		set_variable = VYA_nonrussians
	}

	option = {
		name = dvg_nov_non_russians.1.a
		default_option = yes

		if = {
			limit = {
				NOT = { has_law = law_type:law_racial_segregation }
			}
			activate_law = law_type:law_racial_segregation
		}

		c:NOV = {
			trigger_event = {
				id = dvg_nov_non_russians.3
				days = 7
				popup = yes
			}
		}

		ai_chance = {
			base = 75
		}
	}

	option = {
		name = dvg_nov_non_russians.1.b

		set_variable = VYA_cringe
		
		ai_chance = {
			base = 25
		}
	}
}

dvg_nov_non_russians.3 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_capitalists_meeting.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/capitalists_meeting"

	icon = "gfx/interface/icons/event_icons/event_default.dds"

	title = dvg_nov_non_russians.3.t
	desc = dvg_nov_non_russians.3.d
	flavor = dvg_nov_non_russians.3.f

	duration = 3

	option = {
		name = dvg_nov_non_russians.3.a
		default_option = yes
		
		change_relations = { 
			country = c:BLO 
			value = 50 
		}
		change_relations = { 
			country = c:UGG 
			value = 50 
		}
		change_relations = { 
			country = c:VYA 
			value = -25 
		}
		change_relations = { 
			country = c:PRM 
			value = -25 
		}

		c:VYA = {
			change_relations = { 
				country = c:NOV 
				value = -25 
			}
			trigger_event = {
				id = dvg_nov_non_russians.4
				days = 3
				popup = yes
			}
		}

		ai_chance = {
			base = 45
		}
	}

	option = {
		name = dvg_nov_non_russians.3.b

		c:VYA = {
			set_variable = VYA_nonrussians_end
		}
		set_variable = VYA_nonrussians_end

		remove_modifier = dvg_yasak
		add_modifier = { 
			name = dvg_conscription_law
			months = very_long_modifier_time
		}

		change_relations = { 
			country = c:BLO 
			value = -25 
		}
		change_relations = { 
			country = c:UGG 
			value = -25 
		}
		change_relations = { 
			country = c:VYA 
			value = 25 
		}
		change_relations = { 
			country = c:PRM 
			value = 25 
		}

		#change_variable = {
		#	name = NOV_polar
		#	add = -1
		#}

		ai_chance = {
			base = 30
		}
	}
}

dvg_nov_non_russians.4 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_capitalists_meeting.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/capitalists_meeting"

	icon = "gfx/interface/icons/event_icons/event_default.dds"

	title = dvg_nov_non_russians.4.t
	desc = dvg_nov_non_russians.4.d
	flavor = dvg_nov_non_russians.4.f

	duration = 3

	option = {
		name = dvg_nov_non_russians.4.a
		default_option = yes
		
		change_relations = { 
			country = c:NOV 
			value = 25 
		}

		if = {
			limit = {
				NOT = { has_law = law_type:law_national_supremacy }
			}
			activate_law = law_type:law_national_supremacy
		}

		set_variable = VYA_cringe

		ai_chance = {
			base = 33
		}
	}

	option = {
		name = dvg_nov_non_russians.4.b

		c:NOV = {
			set_variable = VYA_nonrussians_end
		}
		set_variable = VYA_nonrussians_end

		ai_chance = {
			base = 66
		}
	}
}

dvg_nov_non_russians.5 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_political_extremism.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/political_extremism"

	icon = "gfx/interface/icons/event_icons/event_default.dds"

	title = dvg_nov_non_russians.5.t
	desc = dvg_nov_non_russians.5.d
	flavor = dvg_nov_non_russians.5.f

	duration = 3

	trigger = {
		exists = c:VYA
		this = c:VYA
		is_at_war = no
	 	has_variable = VYA_nonrussians
	 	has_variable = VYA_cringe
	}

	immediate = {
		remove_variable = VYA_cringe
	}

	option = {
		name = dvg_nov_non_russians.5.a
		default_option = yes

		add_radicals = {
			value = 0.4
			culture = cu:ugrian
		}

		trigger_event = {
			id = dvg_nov_non_russians.6
			days = 7
			popup = yes
		}
	}
}

dvg_nov_non_russians.6 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_before_the_battle.bk2"
	}
	
	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/before_the_battle"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	title = dvg_nov_non_russians.6.t
	desc = dvg_nov_non_russians.6.d
	flavor = dvg_nov_non_russians.6.f

	duration = 3

	immediate = {
		c:NOV = {
			remove_diplomatic_pact = {
				country = c:VYA
				type = puppet
			}
			change_relations = { 
				country = c:VYA 
				value = -100
			}
		}
	}

	option = {
		name = dvg_nov_non_russians.6.a
		default_option = yes

		add_radicals = {
			value = 0.4
			culture = cu:ugrian
		}

		set_global_variable = UDM_WAR

		# Create UDM
		create_country = {
			tag = UDM
			origin = this
			state = s:STATE_VYATKA.region_state:VYA
		}
		s:STATE_VYATKA = {
			set_owner_of_provinces = {
				country = c:VYA
				provinces = { "x062B1B" "x0D7D00" "x132F3A" "x1910A8" "x1C24B7" "x2101B3" "x2D9E21" "x3BB87B" "x568002" "x5D5433" "x5E8636" "x61562C" "x643CDB" "x67657B" "x67980D" "x6C039E" "x6C1B87" "x7CFCC5" "x80F7CE" "x9E8C5F" "xA000C0" "xAF5831" "xC29095" "xCE626F" "xD53291" "xE82CFC" "xF62997" "xFD9F1D" }
			}
		}

		c:UDM = {
			activate_law = law_type:law_monarchy
			activate_law = law_type:law_autocracy 
		}

		create_diplomatic_play = {
			target_country = c:UDM
			war = yes
			type = dp_annex_war
			
			add_war_goal = {
				holder = c:UDM
				type = conquer_state
				target_state = s:STATE_VYATKA.region_state:VYA
			}
		}

		c:NOV = {
			trigger_event = {
				id = dvg_nov_non_russians.7
				days = 0
				popup = yes
			}
		}
	}
}

dvg_nov_non_russians.7 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_before_the_battle.bk2"
	}
	
	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/before_the_battle"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	title = dvg_nov_non_russians.7.t
	desc = dvg_nov_non_russians.7.d
	flavor = dvg_nov_non_russians.7.f

	duration = 3

	immediate = {

	}

	option = {
		name = dvg_nov_non_russians.7.a
		default_option = yes

		set_variable = nov_udm_war

		create_diplomatic_play = {
			target_country = c:UDM
			war = yes
			type = dp_annex_war
			
			add_war_goal = {
				holder = c:UDM
				type = war_reparations
			}
		}

		create_diplomatic_pact = {
			country = c:VYA
			type = puppet
		}
	}
}

# Bad ending NOV
dvg_nov_non_russians.10 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_before_the_battle.bk2"
	}
	
	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/before_the_battle"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	title = dvg_nov_non_russians.10.t
	desc = dvg_nov_non_russians.10.d
	flavor = dvg_nov_non_russians.10.f

	duration = 3

	trigger = {
		exists = c:NOV
		this = c:NOV
		exists = c:UDM
		is_at_war = no
		has_global_variable = UDM_WAR
		has_variable = nov_udm_war
		NOT = { has_variable = VYA_nonrussians_end }
	}

	immediate = {

	}

	option = {
		name = dvg_nov_non_russians.10.a
		default_option = yes

		remove_global_variable = UDM_WAR
		remove_variable = VYA_nonrussians
		remove_variable = nov_udm_war
		set_variable = VYA_nonrussians_end

		#change_variable = {
		#	name = NOV_polar
		#	add = 2
		#}

		if = {
			limit = {
				exists = c:VYA
			}

			c:VYA = {
				remove_variable = VYA_nonrussians
				set_variable = VYA_nonrussians_end
			}

			create_diplomatic_pact = {
				country = c:VYA
				type = puppet
			}

			trigger_event = {
				id = dvg_nov_non_russians.12
				days = 1
				popup = yes
			}
		}
	}
}

# Good ending NOV
dvg_nov_non_russians.11 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_before_the_battle.bk2"
	}
	
	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/before_the_battle"

	icon = "gfx/interface/icons/event_icons/event_military.dds"

	title = dvg_nov_non_russians.11.t
	desc = dvg_nov_non_russians.11.d
	flavor = dvg_nov_non_russians.11.f

	duration = 3

	trigger = {
		exists = c:NOV
		this = c:NOV
		NOT = { exists = c:UDM }
		is_at_war = no
		has_variable = nov_udm_war
		has_global_variable = UDM_WAR
		NOT = { has_variable = VYA_nonrussians_end }
	}

	immediate = {

	}

	option = {
		name = dvg_nov_non_russians.11.a
		default_option = yes

		trigger = {
			exists = c:VYA
		}

		remove_global_variable = UDM_WAR
		remove_variable = VYA_nonrussians
		remove_variable = nov_udm_war
		set_variable = VYA_nonrussians_end

		if = {
			limit = {
				exists = c:VYA
			}
			
			c:VYA = {
				remove_variable = VYA_nonrussians
				set_variable = VYA_nonrussians_end
			}
	
			create_diplomatic_pact = {
				country = c:VYA
				type = puppet
			}

			trigger_event = {
				id = dvg_nov_non_russians.12
				days = 1
				popup = yes
			}
		}
	}
	option = {
		name = dvg_nov_non_russians.11.b
		default_option = yes

		trigger = {
			NOT = { exists = c:VYA }
		}

		remove_global_variable = UDM_WAR
		remove_variable = VYA_nonrussians
		set_variable = VYA_nonrussians_end
	}
}

# Aftermath
dvg_nov_non_russians.12 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_political_extremism.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/political_extremism"

	icon = "gfx/interface/icons/event_icons/event_default.dds"

	title = dvg_nov_non_russians.12.t
	desc = dvg_nov_non_russians.12.d
	flavor = dvg_nov_non_russians.12.f

	duration = 3

	# Military Government
	option = {
		name = dvg_nov_non_russians.12.a
		default_option = yes

		c:VYA = {
			if = {
				limit = {
					NOT = { has_law = law_type:law_presidential_republic }
				}
				activate_law = law_type:law_presidential_republic
			}
			if = {
				limit = {
					NOT = { has_law = law_type:law_autocracy }
				}
				activate_law = law_type:law_autocracy
			}
			if = {
				limit = {
					NOT = { has_law = law_type:law_national_supremacy }
				}
				activate_law = law_type:law_national_supremacy
			}
		}

		ai_chance = {
			base = 40
		}
	}

	# Bankrupt VYA
	option = {
		name = dvg_nov_non_russians.12.b
		default_option = yes

		trigger_event = {
			id = dvg_nov_non_russians.13
			days = 31
			popup = yes
		}

		ai_chance = {
			base = 60
		}
	}
}

# Vyatka collapse
dvg_nov_non_russians.13 = {
	type = country_event
	placement = ROOT

	event_image = {
		video = "gfx/event_pictures/europenorthamerica_political_extremism.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/europenorthamerica/political_extremism"

	icon = "gfx/interface/icons/event_icons/event_default.dds"

	title = dvg_nov_non_russians.13.t
	desc = dvg_nov_non_russians.13.d
	#flavor = dvg_nov_non_russians.13.f

	duration = 3

	option = {
		name = dvg_nov_non_russians.13.a
		default_option = yes

		annex = c:VYA
	}
}
